# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: prspkt <prspkt@protonmail.com>
pkgname=scrcpy
pkgver=1.24
pkgrel=0
pkgdesc="Display and control your Android device"
url="https://github.com/Genymobile/scrcpy"
arch="x86 x86_64 aarch64 armv7 armhf" # limited by android-tools
license="Apache-2.0"
options="!check" # no test suite
depends="android-tools"
makedepends="ffmpeg-dev mesa-dev meson sdl2-dev libusb-dev"
subpackages="$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion"
source="scrcpy-$pkgver.tar.gz::https://github.com/Genymobile/scrcpy/archive/v$pkgver.tar.gz
	https://github.com/Genymobile/scrcpy/releases/download/v$pkgver/scrcpy-server-v$pkgver"

build() {
	abuild-meson \
		-Dcompile_server=false \
		-Dprebuilt_server=/usr/share/scrcpy/scrcpy-server-v$pkgver \
		. output
	meson compile ${JOBS:+-j ${JOBS}} -C output
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C output
	install -Dm644 "$srcdir"/scrcpy-server-v$pkgver \
		"$pkgdir"/usr/share/scrcpy/scrcpy-server
}

sha512sums="
0eda7d6b0fb7339e1e32114d861194fd6bfce5ddb15d8d241f94278cb5800c2dd6c3bd69ea0b09b2bd5137757e85d679b2c789218e6933d83df4bc07dac09b2e  scrcpy-1.24.tar.gz
1bbc921e954c722307ef4fb2e1478954f6bf14544da362a9edeefd0f90def435bee409130d2ef2fddee98ec6255e12e9bda595507fec479f3feae0a57fb78236  scrcpy-server-v1.24
"
